import request from "@/utils/request";

function page(current, size, courseName
    , semesterId, classroomName) {
    return request({
        method: 'GET',
        url: '/scheduled_course/page',
        params: {
            current: current,
            size: size,
            courseName: courseName,
            semesterId: semesterId,
            classroomName: classroomName,
        }
    });
}

function page_by_student_id(studentId, current, size, courseName
    , semesterId, classroomName) {
    return request({
        method: 'GET',
        url: '/scheduled_course/page_by_student_id',
        params: {
            studentId: studentId,
            current: current,
            size: size,
            courseName: courseName,
            semesterId: semesterId,
            classroomName: classroomName,
        }
    });
}

function page_by_teacher_id(teacherId, current, size, courseName
    , semesterId, classroomName) {
    return request({
        method: 'GET',
        url: '/scheduled_course/page_by_teacher_id',
        params: {
            teacherId: teacherId,
            current: current,
            size: size,
            courseName: courseName,
            semesterId: semesterId,
            classroomName: classroomName,
        }
    });
}

function get_all() {
    return request({
        method: 'GET',
        url: '/scheduled_course/list',
    });
}

function add(attendence, session, courseId, dayOfWeek, classroomId,
    classId, teacherId, departmentId
) {
    return request({
        method: 'POST',
        url: '/scheduled_course',
        data: {
            attendence: attendence,
            session: session,
            courseId: courseId,
            dayOfWeek: dayOfWeek,
            classroomId: classroomId,
            classId: classId,
            teacherId: teacherId,
            departmentId: departmentId,
        }
    });
}

function edit(id, attendence, session, courseId, dayOfWeek, classroomId,
    classId, teacherId, departmentId
) {
    return request({
        method: 'PUT',
        url: '/scheduled_course',
        data: {
            id: id,
            attendence: attendence,
            session: session,
            courseId: courseId,
            dayOfWeek: dayOfWeek,
            classroomId: classroomId,
            classId: classId,
            teacherId: teacherId,
            departmentId: departmentId,
        }
    });
}

function del(id) {
    return request({
        method: 'DELETE',
        url: `/scheduled_course/${id}`,
    });
}

export default {
    page,
    page_by_student_id,
    page_by_teacher_id,
    get_all,
    add,
    edit,
    del,
}